package hao.itheima.controller;

import hao.itheima.annotation.Log;
import hao.itheima.entity.PageBean;
import hao.itheima.entity.Result;
import hao.itheima.service.LogService;
import lombok.Generated;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/log")
public class LogController {

    @Autowired
    private LogService logService;

    @GetMapping("/page")
    public Result findPage(
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "10") Integer pageSize
    ) {
        //1.调用service层进行分页处理, 并回去数据返回
        PageBean pageBean = logService.findpage(page, pageSize);
        return Result.success(pageBean);
    }
}
